// 将后台返回的中文字典项国际化
import BigNumber from "bignumber.js";

export function legalTenderRechargeLanguage(globalProperties, str) {
    switch (str) {
        case '未支付':
            return globalProperties.$t("all.unpaid");
        case '支付完成':
            return globalProperties.$t("all.paymentCompleted");
        case '支付失败':
            return globalProperties.$t("all.paymentFailed");
        case 'promptpay':
            return 'promptpay';
        case 'TrueMoeny':
            return 'TrueMoeny';
        case '网银':
            return globalProperties.$t("all.onlineBanking");
        case '扫码':
            return globalProperties.$t("all.scanQRCode");
        case '电子钱包':
            return globalProperties.$t("all.electronicWallet");
        case 'BCA':
            return 'BCA';
        case '待审核':
            return globalProperties.$t("all.shenhezhong");
        case '提现中':
            return globalProperties.$t("all.tixianzhong");
        case '驳回':
            return globalProperties.$t("all.yijujue");
        case '提现成功':
            return globalProperties.$t("all.yichenggong");
        case '提现失败':
            return globalProperties.$t("all.yishibai");
        default:
            return str;
    }
}

// 检查业务编码限额
export function checkQGPayBusinessAmountLimit(business, amount) {
    let minAmount = new BigNumber(business.minAmount);
    let maxAmount = new BigNumber(business.maxAmount);
    let thisAmount = new BigNumber(amount);

    return minAmount.comparedTo(thisAmount) <= 0 && maxAmount.comparedTo(thisAmount) >= 0;
}


const usdtFlag = require('@/assets/images/usdt.png')
const indonesianFlag = require('@/assets/images/LIndonesia.png')
const vietnamFlag = require('@/assets/images/Lyuenan.gif')

// 根据法币编码获得对应的国旗图片
export function getLegalTenderIconByCode(legalTenderCode) {
    switch (legalTenderCode) {
        case 'USDT':
            return usdtFlag
        case 'IDR':
            return indonesianFlag
        case 'VND':
            return vietnamFlag

        default:
            return undefined
    }
}
